﻿Imports Microsoft.VisualBasic

Public Class clsFlow
    Public Shared Function Approve(ByVal approveID As Integer, ByVal approveResult As String) As Boolean
        Dim dat As New clsData
        Dim sql As New MyStringBuilder

        sql.AppendFormat("update ApproveRecord set ")
        sql.AppendFormat(" ApproveResult='{0}'", approveResult)
        sql.AppendFormat(",Comment='{0}'", "")
        sql.AppendFormat(",ApproveDate={0}", "getdate()")
        sql.AppendFormat("where ApproveID={0}", approveID)

        dat.AccData(sql)

        Return True

    End Function

    Public Shared Function AddApprover(ByVal formName As String, ByVal formID As String, ByVal approver As String) As Boolean
        Dim dat As New clsData
        Dim sql As New MyStringBuilder

        sql.AppendFormat("insert ApproveRecord(FormID,FormName,Approver,CreateDate,UOrganizationID) select ")
        sql.AppendFormat(" {0}", formID)
        sql.AppendFormat(",'{0}'", formName)
        sql.AppendFormat(",'{0}'", approver)
        sql.AppendFormat(",{0}", "getdate()")
        sql.AppendFormat(",{0} ", "u.UOrganizationID")
        sql.AppendFormat("from [InternalUser] u ")
        sql.AppendFormat("where u.UserID = '{0}' ", approver)

        dat.AccData(sql)

        Return True
    End Function
End Class
